package com.xiaoshuidi.cloud.module.finance.mq.consumer;

import com.xiaoshuidi.cloud.module.finance.mq.message.PayChannelRefreshMessage;
import com.xiaoshuidi.cloud.module.finance.service.merchant.PayChannelService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.ApplicationListener;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

@Slf4j
@Component
public class PayChannelRefreshConsumer implements ApplicationListener<PayChannelRefreshMessage> {

    @Resource
    private PayChannelService payChannelService;

    @Override
    public void onApplicationEvent(PayChannelRefreshMessage message) {
        log.info("[onApplicationEvent][收到刷新支付渠道消息]");
        payChannelService.initLocalCache();
    }
}
